package com.sfac.springboot.springboot.modules.common.vo;

import com.fasterxml.jackson.annotation.JsonFormat;

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ImageType {
    PROFILE_BIG("profileBig",1024,1000,1000),
    PROFILE_MIDDLE("profileMiddle",500,300,300),
    PROFILE_SMALL("profileSmall",100,20,20)
    ;
    public String name;
    public int size;
    public int width;
    public int height;

    ImageType(String name, int size, int width, int height) {
        this.name = name;
        this.size = size;
        this.width = width;
        this.height = height;
    }

    public static ImageType getImageTypeByName(String name){
        ImageType[] imageTypes = ImageType.values();
        for (ImageType item : imageTypes){
            if (name.equals(item.name)){
                return item;
            }
        }
        return ImageType.PROFILE_SMALL;
    }
}
